package com.recruit.g1.common.response;

import lombok.Getter;
import lombok.NoArgsConstructor;

@Getter
@NoArgsConstructor
public enum StateCode {

    OPERATION_SUCCESS(200, "操作成功"),
    OPERATION_FAILED(300, "操作失败"),
    USERNAME_EXISTS(100, "用户名被占用"),
    USERNAME_PASSWORD_ERROR(101, "用户名或密码错误"),
    NOT_LOGIN(102, "未登录"),
    THROWABLE_ERROR(408, "未知异常"),
    VALIDATED_ERROR(508, "参数校验失败");
    private Integer state;
    private String message;
    StateCode(Integer state, String message) {
        this.state = state;
        this.message = message;
    }
    public Integer getState() {
        return state;
    }

    public void setState(Integer state) {
        this.state = state;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }



    public static JsonResult ok(Object data) {
        return new JsonResult(StateCode.OPERATION_SUCCESS, data);
    }

}
